<style type="text/css">
	.dot{
		border:1px solid #fff;width:12px;height:12px;border-radius: 12px;float:left;margin:0 5px;
	}
</style>
<div class="full_w">
    <div class="h_title"><?php echo Yii::t('AdmincpModule.admincp', 'Update Subsriber'); ?></div>
    <?php 
        foreach(Yii::app()->admin->getFlashes() as $key => $message){
            echo '<div class="n_'.$key.'"><p>'.$message."</p></div>\n";
        }
    ?>
    <form action="" method="post" id="frmUser">
        <div class="element">
            <label>Email <span class="red">*</span></label>
            <input type="text" name="subscriber[subscriber_email]" id="title" class="text required" value="<?php echo isset($arrItemInfo['subscriber_email'])?$arrItemInfo['subscriber_email']:null; ?>">
       		<p class="description">Unique email</p>
        </div>
        <div class="element">
            <label>Full name <span class="red">*</span></label>
            <input type="text" name="subscriber[subscriber_name]" id="title" class="text required" value="<?php echo isset($arrItemInfo['subscriber_name'])?$arrItemInfo['subscriber_name']:null; ?>">
        </div>
        <div class="element">
            <label for="name">Description:</label>
            <textarea name="subscriber[subscriber_description]" class="textarea" id="intro"><?php echo isset($arrItemInfo['subscriber_description'])?$arrItemInfo['subscriber_description']:null; ?></textarea>
        </div>
        <div class="element">
        	<label for="name">Allow subscription:</label>
            <select name="subscriber[subscriber_status]" id="status">
            	<option value="1">Yes</option>
                <option value="0" <?php if(isset($arrItemInfo['subscriber_status']) && $arrItemInfo['subscriber_status'] == '0'): ?>selected<?php endif; ?>>No</option>
            </select>
        </div>
    
    	<?php if(!empty($arrLists)):
				if(isset($arrItemInfo['lists'])){
					$arrSubscriberLists = array();
					foreach($arrItemInfo['lists'] as $R){
						$arrSubscriberLists[$R['list_id']] = $R['status'];
					} 
				}
		?>
    	<fieldset>
            <legend>Subscription</legend>
            <?php foreach($arrLists as $R): ?>
            <div class="element">
                <label for="name"><div style="background-color:<?php echo $R['list_color']; ?>;" class="dot"></div> <?php echo $R['list_name']; ?>:</label>
                <select name="list[<?php echo $R['list_id']; ?>]" id="list_<?php echo $R['list_id']; ?>">
                	<option value="">No subscription</option>
                    <option value="-1" <?php if(isset($arrSubscriberLists[$R['list_id']]) && $arrSubscriberLists[$R['list_id']] == '-1'): ?>selected<?php endif; ?>>Waiting approved</option>
                    <option value="0" <?php if(isset($arrSubscriberLists[$R['list_id']]) && $arrSubscriberLists[$R['list_id']] == '0'): ?>selected<?php endif; ?>>Unsubscribed</option>
                    <option value="1" <?php if(isset($arrSubscriberLists[$R['list_id']]) && $arrSubscriberLists[$R['list_id']] == '1'): ?>selected<?php endif; ?>>Subscribed</option>
                </select>
            </div>
            <?php endforeach; ?>
    	</fieldset>
        <?php endif; ?>
        
        <div class="entry">
           <input type="hidden" name="id" id="id" value="<?php echo isset($arrItemInfo['subscriber_id'])?$arrItemInfo['subscriber_id']:null; ?>">
           <button type="submit">Submit</button> <button>Cancel</button>
        </div>
    </form>
</div>
<script type="text/javascript">
	$(function(){
		$('#frmUser').validate();
	});
</script>